/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "三角形.h"
#include <SIMD/CPU_向量计算.h>



S_VecSphere f_graph_取三角形球形包围(vec3* 三角形) {
	S_VecSphere s;
	s.pos = { (三角形[0].x + 三角形[1].x + 三角形[2].x) / 3.0f,
				(三角形[0].y + 三角形[1].y + 三角形[2].y) / 3.0f,
				(三角形[0].z + 三角形[1].z + 三角形[2].z) / 3.0f
	};

	s.radius = vec_len(s.pos - 三角形[0]);
	s.radius = DEF_Max(s.radius, vec_len(s.pos - 三角形[1]));
	s.radius = DEF_Max(s.radius, vec_len(s.pos - 三角形[2]));

	return s;
}



